<template>
  <a-card :bordered='false'>
    <search :config='searchConfig' @search='search' @getHeight='getHeight' />
    <div class='page_table'>
      <vxe-grid
        ref='xGrid'
        :border='true'
        :resizable='true'
        :showOverflow='true'
        size='mini'
        :loading='loading'
        :height='pageHeight-seachHeight-94'
        :align='left'
        :columns='columns'
        :data='dataSource'
        :toolbar-config="tableToolbar"
       :checkbox-config="checkboxConfig"
        v-bind='vexConfig'
        @checkbox-change='selectChangeEvent'
        @checkbox-all="selectChangeEvent"
      >
        <template #toolbar_buttons>
          <div class='table-operator'>
          <a-button type="primary" @click="downExportXls('covisit_service')">导出</a-button>
          </div>
        </template>
        <template #inUrl='{ row }'>
          <viewer :images='row.inUrl'>
            <a-avatar :src='row.inUrl[0]' icon='user' shape='square' size='small'/>
          </viewer>
        </template>
        <template #outUrl='{ row }'>
          <viewer :images='row.outUrl'>
            <a-avatar :src='row.outUrl[0]' icon='user' shape='square' size='small'/>
          </viewer>
        </template>
        <template  #action='{ row,rowIndex }'>
          <a v-has="'getGoodsAdress:update'" @click='handleEdit(row)'>编辑</a>
          <a-divider type='vertical' />
          <a href='javascript:' @click='handleBusiness("收货地址",row)'>日志</a>

        </template>
        <template #receivingAddressCode='{ row,rowIndex }'>
          <a @click="handleDetail(row)">{{ row.receivingAddressCode }}</a>
        </template>
        <template #update='{ row }'>
          <a-switch :checked='row.status' size='small' @change='handleStatus(row,$event)' />
        </template>
        <template #update='{ row }'>
          <a-switch :checked='row.status' size='small' @change='handleStatus(row,$event)' />
        </template>
        <template #pager>
          <vxe-pager
            :layouts="['Total', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump','Sizes', 'FullJump']"
            :currentPage.sync='ipagination.current'
            :page-size.sync='ipagination.pageSize'
            :total='ipagination.total'
            :pageSizes='ipagination.pageSizeOptions'
            @page-change='handlePageChange'>
          </vxe-pager>
        </template>
      </vxe-grid>
    </div>
    <getGoods ref="modalForm" @ok="modalFormOk"></getGoods>
    <business-log ref='businessLog'></business-log>
  </a-card>
</template>

<script>
  import '@/assets/less/TableExpand.less'
  import {PageListMixin} from '@/mixins/PageListMixin'
  import {getAction} from '@/api/manage'
  import ARow from 'ant-design-vue/es/grid/Row'
  import ARangePicker from 'ant-design-vue/es/date-picker/RangePicker'

  export default {
    name: "SignConfigList",
    mixins: [PageListMixin],
    components: {
      ARangePicker,
      ARow
    },
    data() {
      return {
        description: '协访明细报表页面',
        // 表头
        searchConfig: [
          {
            type: 'input',
            name: 'visitAssistUserRealName',
            placeholder: '被协防人'
          },
          {
            type: 'input',
            name: 'visitAssistPosName',
            placeholder: '被协防人职位'
          },
          {
            type: 'input',
            name: 'createName',
            placeholder: '协防人'
          },
          {
            type: 'input',
            name: 'visitPosName',
            placeholder: '协防人职位'
          },
          {
            type: 'date',
            name: 'createDate',
            placeholder: '协防日期'
          }
        ],
        columns: [
          {
            minWidth: 60,
            type: 'checkbox',
          },
          {
            title: '客户编码',
            minWidth: 80,
            field: 'clientCode'
          },
          {
            title: '客户名称',
            minWidth: 80,
            field: 'clientName'
          },
          // {
          //   title: '客户类型',
          //   minWidth: 80,
          //   field: 'clientType'
          // },
          {
            title: '提交时间',
            minWidth: 80,
            field: 'createTime',
          },
          {
            title: '被协访人员',
            minWidth: 120,
            field: 'visitAssistUserRealName'
          },
          {
            title: '被协访人职位',
            minWidth: 130,
            field: 'visitAssistPosName'
          },
          {
            title: '被协访人员所属组织',
            minWidth: 130,
            field: 'visitAssistOrgName',
          },
          {
            title: '协访人姓名',
            minWidth: 130,
            field: 'createName'
          },
          {
            title: '协访人员职位',
            minWidth: 120,
            field: 'visitPosName'
          },
          {
            title: '协访人组织',
            minWidth: 120,
            field: 'orgName'
          },
          {
            title: '进店时间',
            minWidth: 80,
            field: 'visitInTime'
          },
          {
            title: '进店打卡照片',
            minWidth: 100,
            field: 'inUrl',
            slots: { default: 'inUrl' },
          },
          {
            title: '离店时间',
            minWidth: 80,
            field: 'visitOutTime'
          },
          {
            title: '离店打卡图片',
            minWidth: 100,
            field: 'outUrl',
            slots: { default: 'outUrl' }
          },
        ],
        isorter: {
          visitType: '2',
          permflag: 'plan_detail_page_impl'
        },
        url: {
          list: window._CONFIG['domianSfaURL'] + "/visit/sfaVisitInfoController/findPageList",
          delete: window._CONFIG['domianSfaURL'] + "/signConfig/deleteById",
          deleteBatch: window._CONFIG['domianSfaURL'] + "/signConfig/deleteBatch",
          startOrStopUrl: window._CONFIG['domianSfaURL'] + "/signConfig/status/startOrStop"
        }
      }
    },

    methods: {}
  }
</script>

<style scoped>
  @import '~@assets/less/common.less';
</style>